package com.main.easycare;

import ecriture.FormulaireEcriture;
import memory.Display_memoryActivity;
import nfc.EasyCare;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity implements OnClickListener {

	/*
	 * Declaration des variables
	 */
	private Button bouton_server;
	private Button bouton_historique;
	private Button bouton_lecture;
	private Button bouton_ecriture;
	private Button bouton_affichage;
	private Button bouton_memoire;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		/*
		 * Initialisation des variables
		 */

		bouton_server = (Button)findViewById(R.id.main_server);
		bouton_ecriture = (Button)findViewById(R.id.main_ecriture);
		bouton_historique = (Button)findViewById(R.id.main_historique);
		bouton_lecture = (Button)findViewById(R.id.main_lecture);
		bouton_affichage = (Button)findViewById(R.id.main_affichage);
		bouton_memoire = (Button)findViewById(R.id.main_memoire);

		bouton_ecriture.setOnClickListener(this);
		bouton_historique.setOnClickListener(this);
		bouton_lecture.setOnClickListener(this);
		bouton_server.setOnClickListener(this);
		bouton_affichage.setOnClickListener(this);
		bouton_memoire.setOnClickListener(this);

		/*
		 * 
		 */
//		Intent intent = new Intent(MainActivity.this, MenuActivity.class);
//		startActivityForResult(intent,0);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		if(v == bouton_ecriture){
			Intent intent = new Intent(MainActivity.this, FormulaireEcriture.class);
			startActivityForResult(intent,0);
		}

		if(v == bouton_historique){
			//Intent intent = new Intent(MainActivity.this, WriterActivity.class);
			//startActivityForResult(intent,0);
		}

		if(v == bouton_lecture){
			Intent intent = new Intent(MainActivity.this, EasyCare.class);
			startActivityForResult(intent,0);
		}

		if(v == bouton_server){
			//			Intent intent = new Intent(MainActivity.this, ServerActivity.class);
			//			startActivityForResult(intent,0);
		}

		if(v == bouton_affichage){
			Intent intent = new Intent(MainActivity.this, DisplayPatient.class);
			startActivityForResult(intent,0);
		}
		
		if(v == bouton_memoire){
			Intent intent = new Intent(MainActivity.this, Display_memoryActivity.class);
			startActivityForResult(intent,0);
		}

	}

}
